package day01;

/**
 * @author Jetwang
 * @version 1.0
 * @since 2023/2/28 12:55
 */
public class RecursionOverflow {

    public static long sum(long n) {
        if (n == 1) {
            return 1;
        }
        return n + sum(n-1);
    }

    public static void main(String[] args) {
        System.out.println(sum(100));
        // 栈溢出
        System.out.println(sum(15000));
    }
}
